﻿<UserControl x:Class="Analyzer.Views.EntityView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
             xmlns:am="http://schemas.amcharts.com/charts/wpf/2009/xaml"             
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="500">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDictionary.xaml"/>
                <ResourceDictionary Source="ScrollViewerResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="5,5,5,5">
        <Grid.RowDefinitions>
            <RowDefinition Height=".75*"/>
            <RowDefinition Height="4*"/>
        </Grid.RowDefinitions>        
        <DockPanel Grid.Row="0" HorizontalAlignment="Stretch" >
            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                    DataContext="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Left"
                    Margin="2,2,2,2">
                <TextBlock Text="Analyzing Element:  " FontSize="20" Foreground="Brown" 
                       TextAlignment="Center" FontFamily="Buxton Sketch"/>
                <TextBlock Text="{Binding RootElementPath}" TextAlignment="Center" FontSize="20"
                        FontFamily="Buxton Sketch" Style="{StaticResource BlinkingTextBox}"/>
            </StackPanel>
            
            <ToolBarTray HorizontalAlignment="Right" Background="Transparent">
                <ToolBar Background="Transparent">
                    <Button ToolTipService.HasDropShadow="True" Background="Transparent" 
                            BorderBrush="Transparent" Command="{Binding SaveSnapshotCommand}"
                            IsEnabled="{Binding}" ToolTip="Save Snapshot">
                        <Image Source="Icons\Save.png" Height="30" Width="30"  />
                    </Button>
                    <Button ToolTipService.HasDropShadow="True" Background="Transparent" ToolTip="Export to Excel"
                            BorderBrush="Transparent" Command="{Binding TreeViewExplodeCommand}" IsEnabled="False">
                        <Image Source="Icons\SaveExcel.png" Height="30" Width="30" Opacity=".5"  />
                    </Button>
                    <Button ToolTipService.HasDropShadow="True" Background="Transparent" ToolTip="Send Email"
                            BorderBrush="Transparent" Command="{Binding TreeViewExplodeCommand}" IsEnabled="False">
                        <Image Source="Icons\SendEmail.png" Height="30" Width="30" Opacity=".5"  />
                    </Button>
                </ToolBar>
            </ToolBarTray>
        </DockPanel>
        

        <Border Grid.Row="1" BorderBrush="Transparent" Margin="2,2,2,2"
                VerticalAlignment="Top" >
            <Grid >
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="5*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="2*" />
                </Grid.ColumnDefinitions>
                
                <DockPanel Grid.Row="0" Grid.Column="0" Margin="2,2,2,2">                    
                    <ListBox BorderBrush="Transparent" BorderThickness="0" 
                                 Foreground="Black" FontWeight="Bold" FocusVisualStyle="{x:Null}"
                                 ItemsSource="{Binding Notes}" MaxWidth="400" VerticalAlignment="Top"
                                 HorizontalAlignment="Left">
                    </ListBox>
                </DockPanel>

                <ScrollViewer Background="#FFF8F8F8"                          
                          CanContentScroll="True"
                          Margin="5,5,5,5"
                          Grid.Row="1" Grid.Column="0"
                          VerticalScrollBarVisibility="Auto"
                          HorizontalScrollBarVisibility="Auto">
                    <ItemsControl ItemsSource="{Binding Items}"
                                  MaxHeight="200"
                                  Background="Azure" BorderBrush="Transparent"
                                  ItemTemplate="{StaticResource TreeViewDataTemplate}" 
                                  FontSize="15" VerticalAlignment="Top"
                                  FontFamily="Buxton Sketch" FontWeight="Bold"     
                                  Margin="10,10,10,10"/>               
                </ScrollViewer>
                <Grid Grid.Row="0" Grid.Column="1" Grid.RowSpan="2">
                    <ScrollViewer Background="Transparent"                        
                          CanContentScroll="True"
                          Margin="5,2,5,10"                                                   
                          VerticalScrollBarVisibility="Auto"
                          HorizontalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock FontFamily="Buxton Sketch" FontSize="40" Padding="2"
                                   Grid.Row="0" FontWeight="Bold" Text="Graphical Analysis"
                                   HorizontalAlignment="Center" VerticalAlignment="Top"/>                         
                            <am:PieChart Margin="0,200,0,0" Padding="2"
                                  Background="Transparent"
                                  SlicesSource="{Binding ChartItems}"
                                  ValueMemberPath="Value"
                                  TitleMemberPath="Title"
                                  InnerRadius="50" PieHeight="50" PieAngle="30" Radius="150"
                                  MaxWidth="600" MaxHeight="400"
                                  LabelMaxWidth="140"
                                  HorizontalContentAlignment="Center"
                                  LegendEnabled="False"
                                  SelectionMode="Extended">

                                <am:PieChart.GradientMask>
                                    <RadialGradientBrush>
                                        <GradientStop Color="#80000000" Offset="0.5" />
                                        <GradientStop Color="#30000000" Offset="1" />
                                    </RadialGradientBrush>
                                </am:PieChart.GradientMask>                                
                            </am:PieChart>
                        </StackPanel>
                    </ScrollViewer>
                </Grid>                
            </Grid>            
        </Border>        
    </Grid>
    
</UserControl>
